package jnpf;

import cn.xuyanwu.spring.file.storage.EnableFileStorage;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import com.zhuozhengsoft.pageoffice.poserver.Server;

/**
 *
 * @author JNPF开发平台组
 * @version V3.1.0
 * @copyright 引迈信息技术有限公司
 * @date 2021/3/15 17:12
 */
@SpringBootApplication(scanBasePackages = {"jnpf"},exclude={DataSourceAutoConfiguration.class})
@EnableFileStorage
public class PurchaseAdminApplication extends SpringBootServletInitializer {
    @Value("${posyspath}")
    private String poSysPath;
    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(PurchaseAdminApplication.class);
        //添加监听器
//        springApplication.addListeners(new JnpfListener());
        springApplication.run(args);
        System.out.println("purchase启动完成");
    }

    @Bean
    public ServletRegistrationBean pageofficeRegistrationBean()  {
        Server poserver = new Server();
        poserver.setSysPath(poSysPath);//设置PageOffice注册成功后,license.lic文件存放的目录
        ServletRegistrationBean srb = new ServletRegistrationBean(poserver);
        srb.addUrlMappings("/poserver.zz");
        srb.addUrlMappings("/poclient");
        srb.addUrlMappings("/pageoffice.js");
        srb.addUrlMappings("/sealsetup.exe");
        return srb;
    }
}
